<include file="common/header" />
<script type="text/javascript" src="/javascript/region.js"></script>
<div class="main-container">
    <div class="container">
        <div class="content user-setting">
            <div class="clearfix mb25 top-title hidden-xs">
                <h1 class="text-center f18 fb">个人设置</h1>
                <a href="/user/support.html" class="ui-btn ui-btn-red ui-btn-mi btn-user-back">返回个人中心</a>
            </div>


            <div class="clearfix mb10 top-title visible-xs">
                <h1 class="text-center f18 fb">个人设置</h1>
                <a href="/user/support.html" class="btn-user-back">返回个人中心</a>
            </div>
            <div class="row visible-xs">
                <ul class="user-left-nav-min">
                    <li class="active col-xs-5">
                        <a href="/user/profile.html">资料修改</a>
                    </li>
                    <li class="col-xs-5 col-xs-offset-2">
                        <a href="/user/password.html">密码修改</a>
                    </li>
                </ul>
            </div>
            <div class="row visible-xs">
                <ul class="user-left-nav-min">
                    <li class="col-xs-5">
                        <a href="/user/avatar.html">头像修改</a>
                    </li>
                    <li class="col-xs-5 col-xs-offset-2">
                        <a href="/user/address.html">收件地址管理</a>
                    </li>
                </ul>
                <ul class="user-left-nav-min">
                    <li class="col-xs-5">
                        <a href="/user/protect.html">手机设置</a>
                    </li>
                </ul>
            </div>




            <div class="wrap-user-setting row">
                <ul class="user-left-nav col-xs-3 hidden-xs">
                    <li class="active">
                        <a href="/user/profile.html">资料修改</a>
                    </li>
                    <li>
                        <a href="/user/password.html">密码修改</a>
                    </li>
                    <li>
                        <a href="/user/avatar.html">头像修改</a>
                    </li>
                    <li>
                        <a href="/user/address.html">收件地址管理</a>
                    </li>
                    <li>
                        <a href="/user/protect.html">手机设置</a>
                    </li>
                </ul>
                <div class="col-sm-9">
                    <div class="setting-content">
                        <form class="ui-form user-setting-form" id="user-setting-form" method="POST">
                            <div class="row">
                                <label class="col-xs-3">真实姓名：</label>
                                <div class="col-xs-8">
                                    <div class="ipt">
                                        <input type="text" <empty name="user.ex_real_name">name="realname"</empty> value="{$user.ex_real_name}" <notempty name="user.ex_real_name">disabled</notempty> placeholder="不能为空"/>
                                    </div>

                                </div>
                            </div>
                            <if condition="($user.user_type eq '')">
                                <div class="row">
                                    <label class="col-xs-3">我的类型：</label>
                                    <div class="form-radio col-xs-8">
                                        <div class="ipt">
                                            <div class="col-xs-6">
                                                <span id="personal_user_type" class="ui-radio <if condition="($user.user_type eq '0')">ui-disabled selected</if>">
                            <input type="radio" name="user_type" value="0" <if condition="($user.user_type eq '0')">checked</if>>
                            </span>个人
                                    </div>
                                        <div class="col-xs-6">
                                            <span id="company_user_type" class="ui-radio <if condition="($user.user_type eq '1')">ui-disabled selected</if>">
                                            <input type="radio" name="user_type" value="1" <if condition="($user.user_type eq '1')">checked</if>>
                                            </span>企业
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <else/>
                            <div class="row">
                                <label class="col-xs-3">我的类型：</label>
                                <div class="form-radio col-xs-8">
                                    <div class="ipt">
                                            <div class="col-xs-6">
                                                <if condition="($user.user_type eq '0')">个人<else />企业</if>
                                            </div>
                                    </div>
                                </div>
                            </div>
                            </if>
                            <div class="row">
                                <label class="col-xs-3">手机号码：</label>
                                <div class="col-xs-8">
                                    <div class="ipt">
                                        <span class="f14">{$user.mobile}</span> <a href="/user/protect.html" class="f14 plr5 ml10" >[更换绑定]</a>
                                    </div>
                                </div>
                            </div>
                            <div class="row">
                                <label class="col-xs-3">
                                    <if condition="($user.user_type eq '')">
                                        上传证件：
                                    <else/>
                                        <if condition="($user.identity_status eq '0')">
                                        上传证件：
                                            <else/>
                                        证件照：
                                        </if>
                                    </if>
                                </label>
                                    <!--<input type="hidden" name="identity_photo" value="{$user.identity_status}">-->
                                <if condition="($user.identity_status eq '0')">
                                        <div class="col-xs-8 mb10">
                                        <a class="ui-btn ui-btn-blue btn-up" id="filePicker">
                                            <if condition="($user.user_type eq '')">
                                                <span class="s">上传证件</span>
                                                <span class="y" style="display:none;">上传证件</span>
                                            </if>
                                            <if condition="($user.user_type eq '0')">
                                                <span class="s">上传身份证</span>
                                                <span class="y" style="display:none;">上传营业执照</span>
                                            </if>
                                            <if condition="($user.user_type eq '1')">
                                                <span class="y">上传营业执照</span>
                                                <span class="s" style="display:none;">上传身份证</span>
                                            </if>
                                        </a>
                                        <span class="fc-red">上传图片不得大于2M，支持gif,jpg,jpeg,png</span>
                                        </div>
                                    </if>
                                <div class="col-xs-8 <if condition="($user.identity_status eq '0')">col-xs-offset-3</if>">
                                    <img id="upload_image" style="<if condition="($user.identity_status eq 0)">display: none;</if>" src="<if condition="($user.identity_status eq 1)">{$identity_filename}</if>">
                                </div>
                            </div>
                            <div class="row">
                                <label class="col-xs-3">性别：</label>
                                <div class="ipt form-radio col-xs-8">
                                    <div class="col-xs-3">
                                        <span class="ui-radio <if condition="($user.sex eq '0')">selected</if>">
                                        <input type="radio" name="sex" value="0" required="required" <if condition="($user.sex eq '0')">checked="checked"</if>></span>男
                                    </div>
                                    <div class="col-xs-3">
                                        <span class="ui-radio <if condition="($user.sex eq '1')">selected</if>"><input type="radio" name="sex" required="required" value="1" <if condition="($user.sex eq '1')">checked="checked"</if>></span>女
                                    </div>
                                    <div class="col-xs-3">
                                        <span class="ui-radio <if condition="($user.sex eq '-1')">selected</if>"><input type="radio" name="sex" required="required" value="-1" <if condition="($user.sex eq '-1')">checked="checked"</if>></span>保密
                                    </div>
                                </div>
                            </div>
                            <div class="row">
                                <label class="col-xs-3">所在地：</label>
                                <div class="ipt col-xs-8">
                                    <div class="col-xs-6">
                                        <select class="form-control province-list" name="province">
                                            <option class="items" rel="0">
                                                <empty name="user.province">
                                                    请选择省份
                                                    <else />
                                                    {$user.province}
                                                </empty>
                                            </option>
                                            <option class="items" data-val="安徽" rel="3">安徽</option>
                                            <option class="items" data-val="澳门" rel="396">澳门</option>
                                            <option class="items" data-val="北京" rel="52">北京</option>
                                            <option class="items" data-val="重庆" rel="394">重庆</option>
                                            <option class="items" data-val="福建" rel="4">福建</option>
                                            <option class="items" data-val="甘肃" rel="5">甘肃</option>
                                            <option class="items" data-val="广东" rel="6">广东</option>
                                            <option class="items" data-val="广西" rel="7">广西</option>
                                            <option class="items" data-val="贵州" rel="8">贵州</option>
                                            <option class="items" data-val="海南" rel="9">海南</option>
                                            <option class="items" data-val="河北" rel="10">河北</option>
                                            <option class="items" data-val="黑龙江" rel="12">黑龙江</option>
                                            <option class="items" data-val="河南" rel="11">河南</option>
                                            <option class="items" data-val="湖北" rel="13">湖北</option>
                                            <option class="items" data-val="湖南" rel="14">湖南</option>
                                            <option class="items" data-val="江苏" rel="16">江苏</option>
                                            <option class="items" data-val="江西" rel="17">江西</option>
                                            <option class="items" data-val="吉林" rel="15">吉林</option>
                                            <option class="items" data-val="辽宁" rel="18">辽宁</option>
                                            <option class="items" data-val="内蒙古" rel="19">内蒙古</option>
                                            <option class="items" data-val="宁夏" rel="20">宁夏</option>
                                            <option class="items" data-val="青海" rel="21">青海</option>
                                            <option class="items" data-val="山东" rel="22">山东</option>
                                            <option class="items" data-val="上海" rel="321">上海</option>
                                            <option class="items" data-val="山西" rel="23">山西</option>
                                            <option class="items" data-val="陕西" rel="24">陕西</option>
                                            <option class="items" data-val="四川" rel="26">四川</option>
                                            <option class="items" data-val="台湾" rel="397">台湾</option>
                                            <option class="items" data-val="天津" rel="343">天津</option>
                                            <option class="items" data-val="香港" rel="395">香港</option>
                                            <option class="items" data-val="西藏" rel="28">西藏</option>
                                            <option class="items" data-val="新疆" rel="29">新疆</option>
                                            <option class="items" data-val="云南" rel="30">云南</option>
                                            <option class="items" data-val="浙江" rel="31">浙江</option>
                                        </select>
                                    </div>
                                    <div class="col-xs-6">
                                        <select class="form-control city-list" name="city">
                                            <option class="items" rel="0">
                                                <empty name="user.city">
                                                    请选择城市
                                                    <else />
                                                    {$user.city}
                                                </empty>
                                            </option>
                                        </select>

                                    </div>
                                </div>
                            </div>
                            <div class="row">
                                <label class="col-xs-2 col-xs-offset-1">验证码：</label>
                                <div class="col-xs-3">
                                    <div class="ipt">
                                        <input type="text" name="code" class="code-pic" maxlength="4" placeholder="请输入图片中的验证码">
                                    </div>
                                </div>
                                <div class="pull-left">
                                    <div class="wrap-code">
                                        <div class="text-center pt5 ml5">
                                            <img class="code-img" src="/user/verify_code" alt="验证码">
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="row">
                                <label class="col-xs-3">自我介绍：</label>
                                <div class="col-xs-8">
                                    <div class="wrap-textarea">
                                        <textarea name="intro" class="setting-sum" placeholder="建议您提供个人履历，提升支持者对您的认同。">{$user.intro}</textarea>
                                    </div>
                                </div>
                            </div>
                            <div class="clearfix" style="width: 100%;height: 10px;background-color: #FFF;margin-bottom: 20px;"></div>

                            <div class="row">
                                <label class="col-xs-3">银行名称：</label>
                                <div class="col-xs-8">
                                    <div class="ipt">
                                        <input type="text" name="ex_bank_name" value="{$user.ex_bank_name}">
                                    </div>
                                </div>

                                <div class="clearfix mtb20"></div>
                                <label class="col-xs-3">开户支行：</label>
                                <div class="col-xs-8">
                                    <div class="ipt">
                                        <input type="text" name="ex_bank_branch" value="{$user.ex_bank_branch}">
                                    </div>
                                </div>
                                <div class="clearfix mtb20"></div>
                                <label class="col-xs-3">开户名称：</label>
                                <div class="col-xs-8">
                                    <div class="ipt">
                                        <input type="text" name="ex_bank_author" value="{$user.ex_bank_author}" disabled>
                                    </div>
                                </div>
                                <div class="clearfix mtb20"></div>
                                <label class="col-xs-3">银行帐号：</label>
                                <div class="col-xs-8">
                                    <div class="ipt">
                                        <input type="text" name="ex_account_info" value="{$user.ex_account_info}">
                                    </div>
                                </div>
                            </div>
                            <div class="row">
                                <div class="col-xs-10 col-xs-offset-2">
                                    <p style="color: red;">1. 必须提供项目发起人本人借记卡或银行账户详细信息，以用作众筹资金唯一结算账户。</p>
                                    <p style="color: red;">2. 请不要提供信用卡账户，如由于提供信用卡账户产生银行提现费用，与Richzoo众筹无关。</p>
                                    <p style="color: red;">3. 本收款账户可修改，结算将以项目发起人最后一次提交的账户信息为准。</p>
                                </div>
                            </div>
                            <div class="row ui-btn-group">
                                <a class="ui-btn ui-btn-blue ui-btn-default mr30" id="set-profile">保存</a>
                                <p class="setting-tips f14 fc-red mt20"></p>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
    $(document).ready(function() {
        $("#set-profile").on('click',function(){
            var db = $("#user-setting-form").serialize();
            $.post('/user/profile',db,function(data){
                alert(data.info);
                $(".code-img").attr('src','/user/verify_code?rand='+Math.random())
                if(data.status == 1){
                    window.location.reload();
                }
            },'json')
        });
        <if condition="($user.user_type eq '')">
        $("#personal_user_type").on('click',function(){
            $("#company_user_type input[type='radio']").attr('checked',false);
            $("#personal_user_type input[type='radio']").attr('checked',true);
        });
        $("#company_user_type").on('click',function(){
            $("#personal_user_type input[type='radio']").attr('checked',false);
            $("#company_user_type input[type='radio']").attr('checked',true);
        });
        </if>
        $(".code-pic").val('');
        $('.code-img').attr('src','/user/verify_code?rand='+Math.random());
        var uploader = WebUploader.create({
            auto: true,
            chunked: false,
            method: 'POST',
            disableGlobalDnd: true,
            fileNumLimit: 1,
            //fileSizeLimit: 1024000,
            swf: '/javascript/home/webuploader/Uploader.swf',
            server: '/User/upload_identity',
            pick: '#filePicker',
            accept: {
                title: '选择封面图片',
                extensions: 'gif,jpg,jpeg,png',
                mimeTypes: 'image/*'
            }
        });
        uploader.on('uploadSuccess', function (file,response) {
            var data = JSON.parse(response._raw);
            $('#upload_image').show().attr('src',data.result + '?rand='+Math.random());
//            $('input[name=identity_photo]').val(data.result);
            uploader.reset();
        });
        $("#personal").on('click',function(){
                $(".s").show();
                $(".y").hide();
        });
        $("#company").on('click',function(){
            $(".y").show();
            $(".s").hide();
        })
    });
</script>
<include file="common/footer" />